home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / ctrlalt.zip / CTRLALT.ASM < prev    next >
Assembly Source File  |  1986-04-12  |  38KB  |  1,318 lines

  1.                                  title CTRLALT
  2. cseg segment
  3.          assume cs:cseg, ds:cseg
  4.          org 100H
  5. begin:   jmp install
  6.          ascbuffer label byte
  7. db 13,'CTRLALT Version 1.00   April, 1986',13,10
  8. db       'Copyright R.M.Wilson and B.Simon',26
  9. ;--------------------------------------------------------------------------
  10. background = 1FH             ;    CHANGE COLORS
  11. mainattr = 30H               ;   HERE FOR ASCII
  12. border = 19H                 ;      TABLES  
  13. attrlabel=1BH
  14.  
  15. monobackground = 07H         ;    CHANGE MONOCHROME 
  16. monomainattr = 70H           ;        ATTRIBUTES
  17. monoborder = 0FH             ;           HERE
  18.  
  19. colxor = 2AH                 ; Attributes to XOR for highlighting
  20. monoxor = 77H                ;        for ^@P and ^@<Enter>
  21. asccolxor = 5FH              ;      ...and, respectively,
  22. ascmonoxor =  0FFH           ;     for ASCII tables (^@A and H).
  23.  
  24. colcopyattr = 1EH            ; When COPY command is used.  1EH=Yellow/Blue
  25. monocopyattr = 07H           ;         07H=White/Black
  26.  
  27. begoff = 246       ;Offset for upper left corner of decimal ASCII table.
  28. hexbegoff = 166    ;Ditto for hex.               
  29. attrbegoff= 1546   ;Ditto for Attribute table.
  30. ansibegoff= 1610   ;Ditto for ANSI table.
  31.  
  32. callcombo = 0CH    ;0CH for Ctrl-Alt, 06H for Ctrl-Shift, 0AH for Shift-Alt.
  33. ;------------------------------------------------------------------------
  34.               ;**** DEFAULTS
  35. attrchar   db 24      ;Character used initially by CTRL-ALT-T
  36. drawmode   dw 1       ;0-6   Initial mode for Box Drawing (ALT-NUMPAD). 
  37. drawdown   db 0       ;For Alt-Grey±:   1=dn/rt, 0=neutral, -1=up/lf
  38.               ;Following are for CTRL-ALT-I
  39. fastflag   db 0FFH    ;0 if slow, 0FFH if fast inserting is wanted.
  40. carretflag db 0FFH    ;0 if backspacing, 0FFH if carriage returns are wanted.
  41. ;-------------------------------------------------------------------------
  42.               ;**** SCAN CODES FOR COMMAND KEYS FOLLOW:
  43. commands db 1FH,2EH,25H,18H,1EH,19H,23H,43H
  44.          db 1CH,17H,10H,0CH,0DH,30H,12H
  45.          db 0BH,2,3,4,5,6,7
  46.          db 14H,13H,8,9,0AH
  47.          db 2FH,2CH,31H
  48.               ;**** CORRESPONDING SUBROUTINES TO JUMP TO:
  49. comaddr  dw  Switch,Copy,Kill,Otherasc,decAsc,Print,Hexasc,back2dos
  50.          dw  cUt,Insert,stopstart,slowspeed,fastspeed,Backsp,asciiEnter
  51.          dw  setdraw,setdraw,setdraw,setdraw,setdraw,setdraw,setdraw
  52.          dw  showaTtrs,carRets,setdrawup,unsetdrawdown,setdrawdown
  53.          dw  Vanilla,Zilch,showaNsi
  54. ;-------------------------------------------------------------------------
  55.               ;**** SCAN CODES FOR CTRL-ALT-P  SUBCOMMANDS FOLLOW:
  56. prtcoms db 1CH,19H,50H,48H,49H,51H,1EH,1,1FH,4FH,47H,13H
  57. begincodes label byte ;Control codes to prn only below.
  58.         db 30H,11H,2EH,20H,14H,3H,16H,9H
  59.         db 25H,2,21H,12H,17H,10H,31H,18H
  60.               ;**** CORRESPONDING SUBROUTINES TO JUMP TO:
  61. prtaddr dw enter,enter,dnarr,uparr,pgup,pgdn,all,esc,pswitch,pend,phome,reset
  62. codeaddr dw bold,wide,cond,dstrike,tiny,charset2,underline,lf8   
  63.          dw skipperf,unidir,topform,emph,pica,qual,newpage,alloff
  64. ;-------------------------------------------------------------------------
  65.               ;**** SCAN CODES FOR CTRL-ALT-ENTER SUBCOMMANDS FOLLOW:
  66. cutcoms db   16H,50H,48H,4DH,4BH,1H,52H,1CH,17H,37H
  67.         db   19H,49H,51H,4EH,4AH,2EH,1FH,47H,4FH
  68.         db   12H
  69.               ;**** CORRESPONDING SUBROUTINES TO JUMP TO:
  70. cutaddr dw ccut,cdnarr,cuparr,crtarr,clfarr,cesc,tack,tack,immenter,prtbox
  71.         dw prtbox,cpgdn,cpgup,cgplus,cgminus,ccopy,cswitch,home,end
  72.         dw immenter
  73. ;-------------------------------------------------------------------------
  74.               ;**** SCAN CODES FOR CTRL-ALT-A/H SUBCOMMANDS FOLLOW:
  75. asccoms db  30H,12H,48H,50H,4DH,4BH,37H,19H,1
  76.         db  47H,4FH,1CH
  77.               ;**** CORRESPONDING SUBROUTINES TO JUMP TO:
  78. ascaddr dw  ascbuff,ascins,ascup,ascdn,ascrt,asclf,ascprn,ascprn,ascesc
  79.         dw  aschome,ascend,ascins
  80. ;------------------------------------------------------------------------------
  81. bold        db  27,69,27,71,0FFH    ;emph & double strike          
  82. dstrike     db  27,71,0FFH
  83. underline   db  27,45,1,0FFH
  84. tiny        db  27,83,1,27,65,5,27,50,15,0FFH
  85. lf8         db  27,48,0FFH
  86. charset2    db  27,54,0FFH
  87. cond        db  15,0FFH
  88. wide        db  27,87,1,0FFH
  89. skipperf    db  27,78,8,0FFH
  90. unidir      db  27,85,1,0FFH
  91. topform     db  12,0FFH
  92. emph        db  27,69,0FFH
  93. pica        db  27,58,0FFH    ;proprinter
  94. qual        db  27,73,2,0FFH  ;proprinter
  95. newpage     db  27,52,0FFH    ;proprinter
  96. alloff      db  27,70,27,72,18,27,87,0,27,84,27,79,27,55
  97.             db  27,45,0,27,65,12,27,50,27,73,0,13,0FFH
  98. ;####################################################################
  99.          oldvec = 5CH
  100.          oldtvec= 60H
  101. ;####################################################################
  102. on_flag  db 0   ;1--Marking, 2--^@P
  103. myint:   push ax                       ;Replacement for Interrupt 9.
  104.          push ds
  105.          sub ax,ax
  106.          mov ds,ax
  107.          mov al,ds:[417H]
  108.          and al,0FH            
  109.          cmp al,callcombo             
  110.          je readport
  111.          cmp al,8  ;alt      
  112.          jne exit
  113.          cmp cs:drawmode,0
  114.          je exit
  115.          in al,60H
  116.          sub al,47H
  117.          jc exit
  118.          cmp al,11
  119.          ja exit
  120.          jmp draw
  121. readport:in al,60H ;Read port to see what happened.
  122.          push bp
  123.          cld
  124.          xor bp,bp
  125.          ck:cmp al, cs:commands[bp]
  126.          je lets_go
  127.          inc bp
  128.          cmp bp,offset comaddr - offset commands ;number of commands
  129.          jl ck 
  130.          pop bp
  131. exit:    pop ds
  132.          pop ax
  133.          jmp dword ptr cs:[oldvec]     
  134. lets_go: push es
  135.          push bx
  136.          push cx
  137.          push dx
  138.          push si
  139.          push di
  140.          call reset_keyboard
  141.          shl bp,1
  142.          jmp cs:comaddr[bp]
  143. reset_keyboard:
  144.          cli
  145.              in al,61H    ;This stuff is necessary for PC and XT  
  146.              mov ah,al    ;...could be omitted for AT.            
  147.              or al,80H 
  148.              out 61H,al
  149.              xchg ah,al
  150.              out 61H,al
  151.          mov al,20H
  152.          out 20H,al
  153.          sti                      
  154.          ret
  155. ;==========================================
  156. back2dos:mov ah,4CH
  157.          int 21H
  158. ;==========================================
  159. vanilla: mov ax,0B000H
  160.          mov es,ax
  161.          mov al,7
  162.          jmp short l34
  163. copy:    call aim
  164.          rep movsw
  165.          l34:mov di,1
  166.          mov cx,2000
  167.          clr:stosb
  168.          inc di
  169.          loop clr
  170.          jmp short endint
  171. kill:    call aim
  172.          mov ax,720H
  173.          rep stosw
  174.          jmp short endint
  175.                      aim: mov cx,2000   ;Sets cx,es,ds,si=di=0,al,xorattr
  176.                           mov ax,0B000H
  177.                           xor si,si
  178.                           xor di,di
  179.                           mov ds,di
  180.                           mov bl,byte ptr ds:[410H]
  181.                           mov ds,ax
  182.                           mov es,ax
  183.                           add ah,8H
  184.                           test bl,10H
  185.                           je cmon
  186.                           mov es,ax
  187.                           mov cs:xorattr,monoxor 
  188.                           mov al,colcopyattr
  189.                           ret
  190.                      cmon:mov ds,ax       ;color monitor in use
  191.                           mov cs:xorattr,colxor
  192.                           mov al,monocopyattr
  193.                           ret
  194. ;==========================================
  195. endint:  pop di
  196. endint2: pop si
  197.          pop dx
  198.          pop cx
  199.          pop bx
  200.          pop es
  201.          pop bp
  202.          pop ds
  203.          pop ax
  204.          iret
  205. ;==============================
  206. switch:  call aim ; sets si,di,cx,bl
  207.          push bx  ;  get cursor
  208.          push cx
  209.          mov ah,3
  210.          xor bh,bh
  211.          int 10H
  212.          mov ch,20H   ;turn off cursor
  213.          mov ah,1
  214.          int 10H
  215.          pop cx
  216.          pop bx
  217.          push ds
  218.          mov ds,di
  219.          xor bl,10H
  220.